package com.dididoctor.doctor.Activity.Usercentre.Authentication;

import android.content.Intent;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.dididoctor.doctor.Activity.Login.DisclaimerActivity;
import com.dididoctor.doctor.Activity.mvp.MainActivity;
import com.dididoctor.doctor.Dialog.CallPhoneDialog;
import com.dididoctor.doctor.MV.EduActivity;
import com.dididoctor.doctor.R;

/**
 * Created by boy on 2016/4/20.
 */
public class AuthenticationOkActivity extends EduActivity {
    private TextView mTvTitle;
    private ImageView mBtnBack;
    private ImageView mIvCommitResult;
    private TextView mTvCommitResult, mTvCommitContent;
    private Button mBtnConfirm, mBtnCallService;
    private String status,ispass;
    private String phoneNumber = "13810884835";

    @Override
    public void setContentLayout() {
        setContentView(R.layout.activity_authenticationok);
        status = getIntent().getStringExtra("status");
        ispass = getIntent().getStringExtra("ispass");
    }

    @Override
    public void init() {
        /**头部**/
        initTitleView();

        /** 界面**/
        initview();

        initData();
    }

    private void initData() {
        if ("1".equals(status)) {
            mIvCommitResult.setBackgroundResource(R.drawable.img_rob_succeed);
            mTvCommitResult.setText("提交成功");
            mTvCommitContent.setText("恭喜您提交成功，您的信息正在审核中，如果着急登录我们的平台，请联系客服申请加急办理对您造成的不便望您谅解");
            mBtnConfirm.setVisibility(View.VISIBLE);
            mBtnConfirm.setText("确定");
            mBtnConfirm.setOnClickListener(this);
            mBtnCallService.setVisibility(View.VISIBLE);
            mBtnCallService.setText("联系客服");
            mBtnCallService.setOnClickListener(this);
        } else {
            mIvCommitResult.setBackgroundResource(R.drawable.img_rob_defeated);
            mTvCommitResult.setText("抱歉提交失败");
            mTvCommitContent.setText("很抱歉，提交信息失败");
            mBtnConfirm.setVisibility(View.VISIBLE);
            mBtnConfirm.setText("重新提交");
            mBtnConfirm.setOnClickListener(this);
            mBtnCallService.setVisibility(View.VISIBLE);
            mBtnCallService.setOnClickListener(this);
        }

    }

    private void initview() {
        mIvCommitResult = (ImageView) findViewById(R.id.iv_commit_result);
        mTvCommitResult = (TextView) findViewById(R.id.tv_commit_result);
        mTvCommitContent = (TextView) findViewById(R.id.tv_commit_content);
        mBtnConfirm = (Button) findViewById(R.id.btn_confirm);
        mBtnCallService = (Button) findViewById(R.id.btn_call_service);
    }

    private void initTitleView() {
        mTvTitle = (TextView) findViewById(R.id.tv_title);
        mTvTitle.setText("提交结果");
        mBtnBack = (ImageView) findViewById(R.id.btn_back);
    }

    @Override
    public void onClickEvent(View view) {
        switch (view.getId()) {
            case R.id.btn_confirm:
                if ("1".equals(status)) {
                    if ("4".equals(ispass)){
                        finish();
                    }else{
                        Intent intent = new Intent(this, DisclaimerActivity.class);
                        startActivity(intent);
                        finish();
                    }
                } else {
                    finish();
                }
                break;
            case R.id.btn_call_service:
                CallPhoneDialog callPhoneDialog = new CallPhoneDialog(this, "4001129585");
                callPhoneDialog.show();
                break;
            case R.id.btn_back:
                if ("1".equals(status)) {
                    Intent intent = new Intent(AuthenticationOkActivity.this, MainActivity.class);
                    startActivity(intent);
                    finish();
                } else {
                    finish();
                }
                break;
        }

    }


}
